# RUN: yaml2obj %s -o %t.in.o

# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE

# RUN: llvm-objcopy -N func %t.in.o %t.out.o
# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-POST

# RUN: not llvm-objcopy -N .weak.foobar.file1 %t.in.o %t.err.o 2>&1 | FileCheck %s --check-prefix=ERROR

# SYMBOLS: SYMBOL TABLE:
# SYMBOLS-PRE-NEXT: func
# SYMBOLS-NEXT: .weak.foobar.file1
# SYMBOLS-NEXT: foobar
# SYMBOLS-PRE-NEXT: AUX indx 1
# SYMBOLS-POST-NEXT: AUX indx 0
# SYMBOLS-EMPTY:

# ERROR: symbol 'foobar' is missing its weak target

--- !COFF
header:          
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [  ]
sections:        
  - Name:            .text
    Characteristics: [  ]
symbols:         
  - Name:            func
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            .weak.foobar.file1
    Value:           1
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            foobar
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_WEAK_EXTERNAL
    WeakExternal:    
      TagIndex:        1
      Characteristics: IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY
...
